<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>01page</title>
  </head>
  <body>
    <div id="test"></div>
    <!-- 引入react核心库  优先 -->
    <script type="text/javascript" src="../js/react.development.js"></script>
    <!-- 引入react-dom用于支持react操作DOM，依赖react核心库 -->
    <script
      type="text/javascript"
      src="../js/react-dom.development.js"
    ></script>
    <!-- 引入babel，用于将jsx转换为js -->
    <script type="text/javascript" src="../js//babel.min.js"></script>

    <script type="text/babel">
      const VDom = (
        <h1 id="title" onClick={fn}>
          小白第一次测试
        </h1>
      );
      ReactDOM.render(VDom, document.getElementById("test"));

      const title = document.getElementById("title");
      //   title.addEventListener("click", () => {
      //     console.log("title被点击了");
      //   });
      //   title.onclick = () => {
      //     console.log("title被点击了");
      //   };
      function fn() {
        console.log("title被点击了");
      }
    </script>
  </body>
</html>
